import d from './validate.js';
const u = [];
for (let i = 0; i < 256; ++i) u.push((i + 256).toString(16).slice(1));
function l(i, n = 0) {
  return (
    u[i[n + 0]] +
    u[i[n + 1]] +
    u[i[n + 2]] +
    u[i[n + 3]] +
    '-' +
    u[i[n + 4]] +
    u[i[n + 5]] +
    '-' +
    u[i[n + 6]] +
    u[i[n + 7]] +
    '-' +
    u[i[n + 8]] +
    u[i[n + 9]] +
    '-' +
    u[i[n + 10]] +
    u[i[n + 11]] +
    u[i[n + 12]] +
    u[i[n + 13]] +
    u[i[n + 14]] +
    u[i[n + 15]]
  );
}
function p(i, n = 0) {
  const c = l(i, n);
  if (!d(c)) throw TypeError('Stringified UUID is invalid');
  return c;
}
export { p as default, l as unsafeStringify };
